import Vue from 'vue'
import App from '@/App.vue'

Vue.config.productionTip = false                              /*关闭生产环境提示*/

import TypeNav from '@/components/TypeNav/index.vue';         /*引入全局组件-三级联动*/
import Carousel from '@/components/Carousel/index.vue';       /*引入全局组件-轮播图*/
import Pagination from '@/components/Pagination/index.vue';   /*引入全局组件-分页器*/
import {MessageBox, Switch, Checkbox} from 'element-ui'                 /*引入全局组件-ele对话框*/
Vue.component(TypeNav.name, TypeNav)                          /*注册全局组件-三级联动*/
Vue.component(Carousel.name, Carousel)                        /*注册全局组件-轮播图*/
Vue.component(Pagination.name, Pagination)                    /*注册全局组件-轮分页器*/

//挂载ElementUI原型
Vue.prototype.$msgbox = MessageBox
Vue.prototype.$alert = MessageBox.alert

import router from '@/router'                                 /*引入路由*/
import store from '@/store'                                   /*引入仓库*/
import '@/mock/mockServe'                                     /*引入mock数据*/
import "swiper/css/swiper.css"                                /*引入swiper样式*/
import * as API from '@/api'                                  /*导入API中所有的接口*/

//引入图片懒加载插件
import shopify from '@/assets/shopify.png'
import VueLazyload from 'vue-lazyload'

//引入表单校验插件
import "@/plugins/validate"

Vue.use(Switch)
Vue.use(Checkbox)
Vue.use(VueLazyload, {
  loading: shopify
})

new Vue({
  router,                                                     /*路由组件*/
  store,                                                      /*仓库组件*/
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this                                 /*全局事件总线bus*/
    Vue.prototype.$API = API
  }
}).$mount('#app')
